<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>sampleFile - OpenGrok cross reference for /sampleFile</title></head><body>
<script type="text/javascript">/* <![CDATA[ */
function get_sym_list(){return [["Class","xc",[["Board",4]]],["Method","xmt",[["clr",5],["colorstr",11],["count",88],["down",127],["fetch",78],["initialize",22],["left",135],["mark",49],["open",57],["over",94],["over?",105],["pos",8],["put",14],["quit",116],["reset",27],["right",139],["up",131]]]];} /* ]]> */</script><a class="l" name="1" href="#1">1</a><span class="c">#! /<a href="/source/s?path=/usr/">usr</a>/<a href="/source/s?path=/usr/bin/">bin</a>/<a href="/source/s?path=/usr/bin/ruby">ruby</a> -Ku</span>
<a class="l" name="2" href="#2">2</a><span class="c"># -*- coding: utf-8 -*-</span>
<a class="l" name="3" href="#3">3</a>
<a class="l" name="4" href="#4">4</a><b>class</b> <a class="xc" name="Board"/><a href="/source/s?refs=Board" class="xc intelliWindow-symbol" data-definition-place="def">Board</a>
<a class="l" name="5" href="#5">5</a>  <b>def</b> <a class="xmt" name="clr"/><a href="/source/s?refs=clr" class="xmt intelliWindow-symbol" data-definition-place="def">clr</a>
<a class="l" name="6" href="#6">6</a>    <b>print</b> <span class="s">&quot;\e[2J&quot;</span>
<a class="l" name="7" href="#7">7</a>  <b>end</b>
<a class="l" name="8" href="#8">8</a>  <b>def</b> <b>pos</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>)
<a class="l" name="9" href="#9">9</a>    <b>printf</b> <span class="s">&quot;\e[%d;%dH&quot;</span>, <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<span class="n">1</span>, <a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>*<span class="n">2</span>+<span class="n">1</span>
<a class="hl" name="10" href="#10">10</a>  <b>end</b>
<a class="l" name="11" href="#11">11</a>  <b>def</b> <a class="xmt" name="colorstr"/><a href="/source/s?refs=colorstr" class="xmt intelliWindow-symbol" data-definition-place="def">colorstr</a>(<a href="/source/s?defs=id" class="intelliWindow-symbol" data-definition-place="undefined-in-file">id</a>,<a href="/source/s?defs=s" class="intelliWindow-symbol" data-definition-place="undefined-in-file">s</a>)
<a class="l" name="12" href="#12">12</a>    <b>printf</b> <span class="s">&quot;\e[%dm%s\e[0m&quot;</span>, <a href="/source/s?defs=id" class="intelliWindow-symbol" data-definition-place="undefined-in-file">id</a>, <a href="/source/s?defs=s" class="intelliWindow-symbol" data-definition-place="undefined-in-file">s</a>
<a class="l" name="13" href="#13">13</a>  <b>end</b>
<a class="l" name="14" href="#14">14</a>  <b>def</b> <a class="xmt" name="put"/><a href="/source/s?refs=put" class="xmt intelliWindow-symbol" data-definition-place="def">put</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>, <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>, <a href="/source/s?defs=col" class="intelliWindow-symbol" data-definition-place="undefined-in-file">col</a>, <a href="/source/s?defs=str" class="intelliWindow-symbol" data-definition-place="undefined-in-file">str</a>)
<a class="l" name="15" href="#15">15</a>    <b>pos</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>); <a class="d intelliWindow-symbol" href="#colorstr" data-definition-place="defined-in-file">colorstr</a>(<span class="n">43</span>,<a href="/source/s?defs=str" class="intelliWindow-symbol" data-definition-place="undefined-in-file">str</a>)
<a class="l" name="16" href="#16">16</a>    <b>pos</b>(<span class="n">0</span>,<a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>); <b>print</b> <span class="s">&quot;&#27531;&#12426;:&quot;</span>,<a href="/source/s?defs=%40mc" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@mc</a>,<span class="s">&quot;/&quot;</span>,<a href="/source/s?defs=%40total" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@total</a>,<span class="s">&quot;   &quot;</span>
<a class="l" name="17" href="#17">17</a>    <b>pos</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>)
<a class="l" name="18" href="#18">18</a>  <b>end</b>
<a class="l" name="19" href="#19">19</a>  <a href="/source/s?defs=private" class="intelliWindow-symbol" data-definition-place="undefined-in-file">private</a> <a href="/source/s?defs=%5C%3Aclr" class="intelliWindow-symbol" data-definition-place="undefined-in-file">:clr</a>, <a href="/source/s?defs=%5C%3Apos" class="intelliWindow-symbol" data-definition-place="undefined-in-file">:pos</a>, <a href="/source/s?defs=%5C%3Acolorstr" class="intelliWindow-symbol" data-definition-place="undefined-in-file">:colorstr</a>, <a href="/source/s?defs=%5C%3Aput" class="intelliWindow-symbol" data-definition-place="undefined-in-file">:put</a>
<a class="hl" name="20" href="#20">20</a>  <a href="/source/s?defs=CHR" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CHR</a>=[<span class="s">&quot;&#12539;&quot;</span>,<span class="s">&quot;&#65297;&quot;</span>,<span class="s">&quot;&#65298;&quot;</span>,<span class="s">&quot;&#65299;&quot;</span>,<span class="s">&quot;&#65300;&quot;</span>,<span class="s">&quot;&#65301;&quot;</span>,<span class="s">&quot;&#65302;&quot;</span>,<span class="s">&quot;&#65303;&quot;</span>,<span class="s">&quot;&#65304;&quot;</span>,<span class="s">&quot;&#9733;&quot;</span>,<span class="s">&quot;&#9679;&quot;</span>,<span class="s">&quot;@@&quot;</span>]
<a class="l" name="21" href="#21">21</a>  <a href="/source/s?defs=COL" class="intelliWindow-symbol" data-definition-place="undefined-in-file">COL</a>=[<span class="n">46</span>,<span class="n">43</span>,<span class="n">45</span>] <span class="c"># default,opened,over</span>
<a class="l" name="22" href="#22">22</a>  <b>def</b> <a class="xmt" name="initialize"/><a href="/source/s?refs=initialize" class="xmt intelliWindow-symbol" data-definition-place="def">initialize</a>(<a href="/source/s?defs=h" class="intelliWindow-symbol" data-definition-place="undefined-in-file">h</a>,<a href="/source/s?defs=w" class="intelliWindow-symbol" data-definition-place="undefined-in-file">w</a>,<a href="/source/s?defs=m" class="intelliWindow-symbol" data-definition-place="undefined-in-file">m</a>)
<a class="l" name="23" href="#23">23</a>    <span class="c"># &#12466;&#12540;&#12512;&#30436;&#12398;&#29983;&#25104;(h:&#32294;&#65292;w:&#27178;&#65292;m:&#29190;&#24382;&#12398;&#25968;)</span>
<a class="l" name="24" href="#24">24</a>    <a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>=<a href="/source/s?defs=h" class="intelliWindow-symbol" data-definition-place="undefined-in-file">h</a>; <a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>=<a href="/source/s?defs=w" class="intelliWindow-symbol" data-definition-place="undefined-in-file">w</a>; <a href="/source/s?defs=%40m" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@m</a>=<a href="/source/s?defs=m" class="intelliWindow-symbol" data-definition-place="undefined-in-file">m</a>
<a class="l" name="25" href="#25">25</a>    <a class="d intelliWindow-symbol" href="#reset" data-definition-place="defined-in-file">reset</a>
<a class="l" name="26" href="#26">26</a>  <b>end</b>
<a class="l" name="27" href="#27">27</a>  <b>def</b> <a class="xmt" name="reset"/><a href="/source/s?refs=reset" class="xmt intelliWindow-symbol" data-definition-place="def">reset</a>
<a class="l" name="28" href="#28">28</a>    <span class="c"># &#12466;&#12540;&#12512;&#30436;&#12434;(&#20877;)&#21021;&#26399;&#21270;&#12377;&#12427;</span>
<a class="l" name="29" href="#29">29</a>    <b>srand</b>()
<a class="hl" name="30" href="#30">30</a>    <a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>=<span class="n">0</span>; <a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>=<span class="n">0</span>; <a href="/source/s?defs=%40mc" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@mc</a>=<a href="/source/s?defs=%40m" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@m</a>
<a class="l" name="31" href="#31">31</a>    <a href="/source/s?defs=%40over" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@over</a>=<b>false</b>
<a class="l" name="32" href="#32">32</a>    <a href="/source/s?defs=%40data" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@data</a>=<b>Array</b>.<b>new</b>(<a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>*<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>)
<a class="l" name="33" href="#33">33</a>    <a href="/source/s?defs=%40state" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@state</a>=<b>Array</b>.<b>new</b>(<a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>*<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>)
<a class="l" name="34" href="#34">34</a>    <a href="/source/s?defs=%40total" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@total</a>=<a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>*<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>
<a class="l" name="35" href="#35">35</a>    <a href="/source/s?defs=%40total" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@total</a>.<b>times</b> {|<a href="/source/s?defs=i" class="intelliWindow-symbol" data-definition-place="undefined-in-file">i</a>| <a href="/source/s?defs=%40data" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@data</a>[<a href="/source/s?defs=i" class="intelliWindow-symbol" data-definition-place="undefined-in-file">i</a>]=<span class="n">0</span>}
<a class="l" name="36" href="#36">36</a>    <a href="/source/s?defs=%40m" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@m</a>.<b>times</b> <b>do</b>
<a class="l" name="37" href="#37">37</a>       <b>loop</b> <b>do</b>
<a class="l" name="38" href="#38">38</a>         <a href="/source/s?defs=j" class="intelliWindow-symbol" data-definition-place="undefined-in-file">j</a>=<b>rand</b>(<a href="/source/s?defs=%40total" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@total</a>-<span class="n">1</span>)
<a class="l" name="39" href="#39">39</a>         <b>if</b> <a href="/source/s?defs=%40data" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@data</a>[<a href="/source/s?defs=j" class="intelliWindow-symbol" data-definition-place="undefined-in-file">j</a>] == <span class="n">0</span> <b>then</b>
<a class="hl" name="40" href="#40">40</a>           <a href="/source/s?defs=%40data" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@data</a>[<a href="/source/s?defs=j" class="intelliWindow-symbol" data-definition-place="undefined-in-file">j</a>]=<span class="n">1</span>
<a class="l" name="41" href="#41">41</a>           <b>break</b>
<a class="l" name="42" href="#42">42</a>         <b>end</b>
<a class="l" name="43" href="#43">43</a>       <b>end</b>
<a class="l" name="44" href="#44">44</a>    <b>end</b>
<a class="l" name="45" href="#45">45</a>    <a class="d intelliWindow-symbol" href="#clr" data-definition-place="defined-in-file">clr</a>; <b>pos</b>(<span class="n">0</span>,<span class="n">0</span>)
<a class="l" name="46" href="#46">46</a>    <a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>.<b>times</b>{|<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>| <b>pos</b>(<span class="n">0</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>); <a class="d intelliWindow-symbol" href="#colorstr" data-definition-place="defined-in-file">colorstr</a>(<a href="/source/s?defs=COL" class="intelliWindow-symbol" data-definition-place="undefined-in-file">COL</a>[<span class="n">0</span>],<a href="/source/s?defs=CHR" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CHR</a>[<span class="n">0</span>]*<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>)}
<a class="l" name="47" href="#47">47</a>    <b>pos</b>(<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>,<a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>)
<a class="l" name="48" href="#48">48</a>  <b>end</b>
<a class="l" name="49" href="#49">49</a>  <b>def</b> <a class="xmt" name="mark"/><a href="/source/s?refs=mark" class="xmt intelliWindow-symbol" data-definition-place="def">mark</a>
<a class="hl" name="50" href="#50">50</a>    <span class="c"># &#29694;&#22312;&#12398;&#12459;&#12540;&#12477;&#12523;&#20301;&#32622;&#12395;&#12510;&#12540;&#12463;&#12434;&#12388;&#12369;&#12427;</span>
<a class="l" name="51" href="#51">51</a>    <b>if</b> <a href="/source/s?defs=%40state" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@state</a>[<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>*<a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>+<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>] != <b>nil</b> <b>then</b> <b>return</b> <b>end</b>
<a class="l" name="52" href="#52">52</a>    <a href="/source/s?defs=%40state" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@state</a>[<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>*<a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>+<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>] = <span class="s">&quot;MARK&quot;</span>
<a class="l" name="53" href="#53">53</a>    <a href="/source/s?defs=%40mc" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@mc</a>=<a href="/source/s?defs=%40mc" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@mc</a>-<span class="n">1</span>;
<a class="l" name="54" href="#54">54</a>    <a href="/source/s?defs=%40total" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@total</a>=<a href="/source/s?defs=%40total" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@total</a>-<span class="n">1</span>;
<a class="l" name="55" href="#55">55</a>    <a class="d intelliWindow-symbol" href="#put" data-definition-place="defined-in-file">put</a>(<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>, <a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>, <a href="/source/s?defs=COL" class="intelliWindow-symbol" data-definition-place="undefined-in-file">COL</a>[<span class="n">1</span>], <a href="/source/s?defs=CHR" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CHR</a>[<span class="n">9</span>])
<a class="l" name="56" href="#56">56</a>  <b>end</b>
<a class="l" name="57" href="#57">57</a>  <b>def</b> <b>open</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>=<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>=<a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>)
<a class="l" name="58" href="#58">58</a>    <span class="c"># &#29694;&#22312;&#12398;&#12459;&#12540;&#12477;&#12523;&#20301;&#32622;&#12434;&#12458;&#12540;&#12503;&#12531;&#12395;&#12377;&#12427;</span>
<a class="l" name="59" href="#59">59</a>    <span class="c"># &#29190;&#24382;&#12364;&#12354;&#12428;&#12400;&#12466;&#12540;&#12512;&#12458;&#12540;&#12496;&#12540;</span>
<a class="hl" name="60" href="#60">60</a>    <b>if</b> <a href="/source/s?defs=%40state" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@state</a>[<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>*<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>] ==<span class="s">&quot;OPEN&quot;</span>  <b>then</b> <b>return</b> <span class="n">0</span> <b>end</b>
<a class="l" name="61" href="#61">61</a>    <b>if</b> <a href="/source/s?defs=%40state" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@state</a>[<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>*<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>] == <b>nil</b> <b>then</b> <a href="/source/s?defs=%40total" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@total</a>=<a href="/source/s?defs=%40total" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@total</a>-<span class="n">1</span> <b>end</b>
<a class="l" name="62" href="#62">62</a>    <b>if</b> <a href="/source/s?defs=%40state" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@state</a>[<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>*<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>] ==<span class="s">&quot;MARK&quot;</span> <b>then</b> <a href="/source/s?defs=%40mc" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@mc</a>=<a href="/source/s?defs=%40mc" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@mc</a>+<span class="n">1</span> <b>end</b>
<a class="l" name="63" href="#63">63</a>    <a href="/source/s?defs=%40state" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@state</a>[<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>*<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>]=<span class="s">&quot;OPEN&quot;</span>
<a class="l" name="64" href="#64">64</a>    <b>if</b> <a class="d intelliWindow-symbol" href="#fetch" data-definition-place="defined-in-file">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>) == <span class="n">1</span> <b>then</b> <a href="/source/s?defs=%40over" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@over</a> = <span class="n">1</span>; <b>return</b> <b>end</b>
<a class="l" name="65" href="#65">65</a>    <a href="/source/s?defs=c" class="intelliWindow-symbol" data-definition-place="undefined-in-file">c</a> = <b>count</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>)
<a class="l" name="66" href="#66">66</a>    <a class="d intelliWindow-symbol" href="#put" data-definition-place="defined-in-file">put</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>, <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>, <a href="/source/s?defs=COL" class="intelliWindow-symbol" data-definition-place="undefined-in-file">COL</a>[<span class="n">1</span>], <a href="/source/s?defs=CHR" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CHR</a>[<a href="/source/s?defs=c" class="intelliWindow-symbol" data-definition-place="undefined-in-file">c</a>])
<a class="l" name="67" href="#67">67</a>    <b>return</b> <span class="n">0</span> <b>if</b> <a href="/source/s?defs=c" class="intelliWindow-symbol" data-definition-place="undefined-in-file">c</a> != <span class="n">0</span>
<a class="l" name="68" href="#68">68</a>    <b>if</b> <a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a> &gt; <span class="n">0</span> &amp;&amp; <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a> &gt; <span class="n">0</span>         <b>then</b> <b>open</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>-<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>-<span class="n">1</span>) <b>end</b>
<a class="l" name="69" href="#69">69</a>    <b>if</b> <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a> &gt; <span class="n">0</span>                  <b>then</b> <b>open</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,  <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>-<span class="n">1</span>) <b>end</b>
<a class="hl" name="70" href="#70">70</a>    <b>if</b> <a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a> &lt; <a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>-<span class="n">1</span> &amp;&amp; <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a> &gt; <span class="n">0</span>     <b>then</b> <b>open</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>+<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>-<span class="n">1</span>) <b>end</b>
<a class="l" name="71" href="#71">71</a>    <b>if</b> <a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a> &gt; <span class="n">0</span>                  <b>then</b> <b>open</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>-<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>) <b>end</b>
<a class="l" name="72" href="#72">72</a>    <b>if</b> <a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a> &lt; <a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>-<span class="n">1</span>              <b>then</b> <b>open</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>+<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>) <b>end</b>
<a class="l" name="73" href="#73">73</a>    <b>if</b> <a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a> &gt; <span class="n">0</span> &amp;&amp; <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a> &lt; <a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>-<span class="n">1</span>     <b>then</b> <b>open</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>-<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<span class="n">1</span>) <b>end</b>
<a class="l" name="74" href="#74">74</a>    <b>if</b> <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a> &lt; <a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a> -<span class="n">1</span>             <b>then</b> <b>open</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<span class="n">1</span>) <b>end</b>
<a class="l" name="75" href="#75">75</a>    <b>if</b> <a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a> &lt; <a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>-<span class="n">1</span> &amp;&amp; <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a> &lt; <a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>-<span class="n">1</span> <b>then</b> <b>open</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>+<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<span class="n">1</span>) <b>end</b>
<a class="l" name="76" href="#76">76</a>    <b>pos</b>(<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>,<a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>)
<a class="l" name="77" href="#77">77</a>  <b>end</b>
<a class="l" name="78" href="#78">78</a>  <b>def</b> <a class="xmt" name="fetch"/><a href="/source/s?refs=fetch" class="xmt intelliWindow-symbol" data-definition-place="def">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>)
<a class="l" name="79" href="#79">79</a>    <span class="c"># (x,y)&#12398;&#20301;&#32622;&#12398;&#29190;&#24382;&#12398;&#25968;(0 or 1)&#12434;&#36820;&#12377;</span>
<a class="hl" name="80" href="#80">80</a>    <b>if</b> <a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a> &lt; <span class="n">0</span> <b>then</b> <span class="n">0</span>
<a class="l" name="81" href="#81">81</a>    <b>elsif</b> <a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a> &gt;= <a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a> <b>then</b> <span class="n">0</span>
<a class="l" name="82" href="#82">82</a>    <b>elsif</b> <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a> &lt; <span class="n">0</span> <b>then</b> <span class="n">0</span>
<a class="l" name="83" href="#83">83</a>    <b>elsif</b> <a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a> &gt;= <a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a> <b>then</b> <span class="n">0</span>
<a class="l" name="84" href="#84">84</a>    <b>else</b>
<a class="l" name="85" href="#85">85</a>      <a href="/source/s?defs=%40data" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@data</a>[<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>*<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>+<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>]
<a class="l" name="86" href="#86">86</a>    <b>end</b>
<a class="l" name="87" href="#87">87</a>  <b>end</b>
<a class="l" name="88" href="#88">88</a>  <b>def</b> <b>count</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>)
<a class="l" name="89" href="#89">89</a>    <span class="c"># (x,y)&#12395;&#38563;&#25509;&#12377;&#12427;&#29190;&#24382;&#12398;&#25968;&#12434;&#36820;&#12377;</span>
<a class="hl" name="90" href="#90">90</a>    <a class="d intelliWindow-symbol" href="#fetch" data-definition-place="defined-in-file">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>-<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>-<span class="n">1</span>)+<a class="d intelliWindow-symbol" href="#fetch" data-definition-place="defined-in-file">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>-<span class="n">1</span>)+<a class="d intelliWindow-symbol" href="#fetch" data-definition-place="defined-in-file">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>+<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>-<span class="n">1</span>)+
<a class="l" name="91" href="#91">91</a>    <a class="d intelliWindow-symbol" href="#fetch" data-definition-place="defined-in-file">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>-<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>)  +             <a class="d intelliWindow-symbol" href="#fetch" data-definition-place="defined-in-file">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>+<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>)+
<a class="l" name="92" href="#92">92</a>    <a class="d intelliWindow-symbol" href="#fetch" data-definition-place="defined-in-file">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>-<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<span class="n">1</span>)+<a class="d intelliWindow-symbol" href="#fetch" data-definition-place="defined-in-file">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<span class="n">1</span>)+<a class="d intelliWindow-symbol" href="#fetch" data-definition-place="defined-in-file">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>+<span class="n">1</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>+<span class="n">1</span>)
<a class="l" name="93" href="#93">93</a>  <b>end</b>
<a class="l" name="94" href="#94">94</a>  <b>def</b> <a class="xmt" name="over"/><a href="/source/s?refs=over" class="xmt intelliWindow-symbol" data-definition-place="def">over</a>(<a href="/source/s?defs=win" class="intelliWindow-symbol" data-definition-place="undefined-in-file">win</a>)
<a class="l" name="95" href="#95">95</a>    <span class="c"># &#12466;&#12540;&#12512;&#12398;&#32066;&#20102;</span>
<a class="l" name="96" href="#96">96</a>    <a class="d intelliWindow-symbol" href="#quit" data-definition-place="defined-in-file">quit</a>
<a class="l" name="97" href="#97">97</a>    <b>unless</b> <a href="/source/s?defs=win" class="intelliWindow-symbol" data-definition-place="undefined-in-file">win</a>
<a class="l" name="98" href="#98">98</a>      <b>pos</b>(<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>,<a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>); <b>print</b> <a href="/source/s?defs=CHR" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CHR</a>[<span class="n">11</span>]
<a class="l" name="99" href="#99">99</a>    <b>end</b>
<a class="hl" name="100" href="#100">100</a>    <b>pos</b>(<span class="n">0</span>,<a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>)
<a class="l" name="101" href="#101">101</a>    <b>if</b> <a href="/source/s?defs=win" class="intelliWindow-symbol" data-definition-place="undefined-in-file">win</a> <b>then</b> <b>print</b> <span class="s">&quot;*** YOU WIN !! ***&quot;</span>
<a class="l" name="102" href="#102">102</a>    <b>else</b> <b>print</b> <span class="s">&quot;*** GAME OVER ***&quot;</span>
<a class="l" name="103" href="#103">103</a>    <b>end</b>
<a class="l" name="104" href="#104">104</a>  <b>end</b>
<a class="l" name="105" href="#105">105</a>  <b>def</b> <a class="xmt" name="over?"/><a href="/source/s?refs=over%5C%3F" class="xmt intelliWindow-symbol" data-definition-place="def">over?</a>
<a class="l" name="106" href="#106">106</a>    <span class="c"># &#12466;&#12540;&#12512;&#12398;&#32066;&#20102;&#12481;&#12455;&#12483;&#12463;</span>
<a class="l" name="107" href="#107">107</a>    <span class="c"># &#32066;&#20102;&#20966;&#29702;&#12418;&#21628;&#12403;&#20986;&#12377;</span>
<a class="l" name="108" href="#108">108</a>    <a href="/source/s?defs=remain" class="intelliWindow-symbol" data-definition-place="undefined-in-file">remain</a> = (<a href="/source/s?defs=%40mc" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@mc</a>+<a href="/source/s?defs=%40total" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@total</a> == <span class="n">0</span>)
<a class="l" name="109" href="#109">109</a>    <b>if</b> <a href="/source/s?defs=%40over" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@over</a> || <a href="/source/s?defs=remain" class="intelliWindow-symbol" data-definition-place="undefined-in-file">remain</a>
<a class="hl" name="110" href="#110">110</a>      <a class="d intelliWindow-symbol" href="#over" data-definition-place="defined-in-file">over</a>(<a href="/source/s?defs=remain" class="intelliWindow-symbol" data-definition-place="undefined-in-file">remain</a>)
<a class="l" name="111" href="#111">111</a>      <b>true</b>
<a class="l" name="112" href="#112">112</a>    <b>else</b>
<a class="l" name="113" href="#113">113</a>      <b>false</b>
<a class="l" name="114" href="#114">114</a>    <b>end</b>
<a class="l" name="115" href="#115">115</a>  <b>end</b>
<a class="l" name="116" href="#116">116</a>  <b>def</b> <a class="xmt" name="quit"/><a href="/source/s?refs=quit" class="xmt intelliWindow-symbol" data-definition-place="def">quit</a>
<a class="l" name="117" href="#117">117</a>    <span class="c"># &#12466;&#12540;&#12512;&#12398;&#20013;&#26029;(&#12414;&#12383;&#12399;&#32066;&#20102;)</span>
<a class="l" name="118" href="#118">118</a>    <span class="c"># &#30436;&#38754;&#12434;&#20840;&#12390;&#35211;&#12379;&#12427;</span>
<a class="l" name="119" href="#119">119</a>    <a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>.<b>times</b> <b>do</b>|<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>|
<a class="hl" name="120" href="#120">120</a>      <b>pos</b>(<span class="n">0</span>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>)
<a class="l" name="121" href="#121">121</a>      <a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>.<b>times</b> <b>do</b>|<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>|
<a class="l" name="122" href="#122">122</a>	<a class="d intelliWindow-symbol" href="#colorstr" data-definition-place="defined-in-file">colorstr</a>(<b>if</b> <a href="/source/s?defs=%40state" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@state</a>[<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>*<a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>+<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>] == <span class="s">&quot;MARK&quot;</span> <b>then</b> <a href="/source/s?defs=COL" class="intelliWindow-symbol" data-definition-place="undefined-in-file">COL</a>[<span class="n">1</span>] <b>else</b> <a href="/source/s?defs=COL" class="intelliWindow-symbol" data-definition-place="undefined-in-file">COL</a>[<span class="n">2</span>] <b>end</b>,
<a class="l" name="123" href="#123">123</a>		 <b>if</b> <a class="d intelliWindow-symbol" href="#fetch" data-definition-place="defined-in-file">fetch</a>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>)==<span class="n">1</span> <b>then</b> <a href="/source/s?defs=CHR" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CHR</a>[<span class="n">10</span>] <b>else</b> <a href="/source/s?defs=CHR" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CHR</a>[<b>count</b>(<a href="/source/s?defs=x" class="intelliWindow-symbol" data-definition-place="undefined-in-file">x</a>,<a href="/source/s?defs=y" class="intelliWindow-symbol" data-definition-place="undefined-in-file">y</a>)] <b>end</b>)
<a class="l" name="124" href="#124">124</a>      <b>end</b>
<a class="l" name="125" href="#125">125</a>    <b>end</b>
<a class="l" name="126" href="#126">126</a>  <b>end</b>
<a class="l" name="127" href="#127">127</a>  <b>def</b> <a class="xmt" name="down"/><a href="/source/s?refs=down" class="xmt intelliWindow-symbol" data-definition-place="def">down</a>
<a class="l" name="128" href="#128">128</a>    <span class="c"># &#12459;&#12540;&#12477;&#12523;&#12434;&#19979;&#12395;</span>
<a class="l" name="129" href="#129">129</a>    <b>if</b> <a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a> &lt; <a href="/source/s?defs=%40hi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@hi</a>-<span class="n">1</span> <b>then</b> <a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>=<a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>+<span class="n">1</span>; <b>pos</b>(<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>, <a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>) <b>end</b>
<a class="hl" name="130" href="#130">130</a>  <b>end</b>
<a class="l" name="131" href="#131">131</a>  <b>def</b> <a class="xmt" name="up"/><a href="/source/s?refs=up" class="xmt intelliWindow-symbol" data-definition-place="def">up</a>
<a class="l" name="132" href="#132">132</a>    <span class="c"># &#12459;&#12540;&#12477;&#12523;&#12434;&#19978;&#12395;</span>
<a class="l" name="133" href="#133">133</a>    <b>if</b> <a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a> &gt; <span class="n">0</span> <b>then</b> <a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>=<a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>-<span class="n">1</span>; <b>pos</b>(<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>, <a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>) <b>end</b>
<a class="l" name="134" href="#134">134</a>  <b>end</b>
<a class="l" name="135" href="#135">135</a>  <b>def</b> <a class="xmt" name="left"/><a href="/source/s?refs=left" class="xmt intelliWindow-symbol" data-definition-place="def">left</a>
<a class="l" name="136" href="#136">136</a>    <span class="c"># &#12459;&#12540;&#12477;&#12523;&#12434;&#24038;&#12395;</span>
<a class="l" name="137" href="#137">137</a>    <b>if</b> <a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a> &gt; <span class="n">0</span> <b>then</b> <a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>=<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>-<span class="n">1</span>; <b>pos</b>(<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>, <a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>) <b>end</b>
<a class="l" name="138" href="#138">138</a>  <b>end</b>
<a class="l" name="139" href="#139">139</a>  <b>def</b> <a class="xmt" name="right"/><a href="/source/s?refs=right" class="xmt intelliWindow-symbol" data-definition-place="def">right</a>
<a class="hl" name="140" href="#140">140</a>    <span class="c"># &#12459;&#12540;&#12477;&#12523;&#12434;&#21491;&#12395;</span>
<a class="l" name="141" href="#141">141</a>    <b>if</b> <a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a> &lt; <a href="/source/s?defs=%40wi" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@wi</a>-<span class="n">1</span> <b>then</b> <a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>=<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>+<span class="n">1</span>; <b>pos</b>(<a href="/source/s?defs=%40cx" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cx</a>, <a href="/source/s?defs=%40cy" class="intelliWindow-symbol" data-definition-place="undefined-in-file">@cy</a>) <b>end</b>
<a class="l" name="142" href="#142">142</a>  <b>end</b>
<a class="l" name="143" href="#143">143</a><b>end</b>
<a class="l" name="144" href="#144">144</a>
<a class="l" name="145" href="#145">145</a><a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>=<a class="d intelliWindow-symbol" href="#Board" data-definition-place="defined-in-file">Board</a>.<b>new</b>(<span class="n">10</span>,<span class="n">10</span>,<span class="n">10</span>)
<a class="l" name="146" href="#146">146</a><b>system</b>(<span class="s">&quot;stty raw -echo&quot;</span>)
<a class="l" name="147" href="#147">147</a><b>begin</b>
<a class="l" name="148" href="#148">148</a>  <b>loop</b> <b>do</b>
<a class="l" name="149" href="#149">149</a>    <b>case</b> <a href="/source/s?defs=STDIN" class="intelliWindow-symbol" data-definition-place="undefined-in-file">STDIN</a>.<b>getc</b>
<a class="hl" name="150" href="#150">150</a>    <b>when</b> <span class="s">?n</span>  <span class="c"># new game</span>
<a class="l" name="151" href="#151">151</a>      <a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>.<a class="d intelliWindow-symbol" href="#reset" data-definition-place="defined-in-file">reset</a>
<a class="l" name="152" href="#152">152</a>    <b>when</b> <span class="s">?m</span>  <span class="c"># mark</span>
<a class="l" name="153" href="#153">153</a>      <a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>.<a class="d intelliWindow-symbol" href="#mark" data-definition-place="defined-in-file">mark</a>
<a class="l" name="154" href="#154">154</a>    <b>when</b> <span class="s">?j</span>
<a class="l" name="155" href="#155">155</a>      <a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>.<a class="d intelliWindow-symbol" href="#down" data-definition-place="defined-in-file">down</a>
<a class="l" name="156" href="#156">156</a>    <b>when</b> <span class="s">?k</span>
<a class="l" name="157" href="#157">157</a>      <a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>.<a class="d intelliWindow-symbol" href="#up" data-definition-place="defined-in-file">up</a>
<a class="l" name="158" href="#158">158</a>    <b>when</b> <span class="s">?h</span>
<a class="l" name="159" href="#159">159</a>      <a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>.<a class="d intelliWindow-symbol" href="#left" data-definition-place="defined-in-file">left</a>
<a class="hl" name="160" href="#160">160</a>    <b>when</b> <span class="s">?l</span>
<a class="l" name="161" href="#161">161</a>      <a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>.<a class="d intelliWindow-symbol" href="#right" data-definition-place="defined-in-file">right</a>
<a class="l" name="162" href="#162">162</a>    <b>when</b> <span class="s">?\s</span>
<a class="l" name="163" href="#163">163</a>      <a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>.<b>open</b>
<a class="l" name="164" href="#164">164</a>    <b>when</b> <span class="s">?q</span>,<span class="s">?\C-c</span>  <span class="c"># quit game</span>
<a class="l" name="165" href="#165">165</a>      <a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>.<a class="d intelliWindow-symbol" href="#quit" data-definition-place="defined-in-file">quit</a>
<a class="l" name="166" href="#166">166</a>      <b>break</b>
<a class="l" name="167" href="#167">167</a>    <b>end</b>
<a class="l" name="168" href="#168">168</a>    <b>if</b> <a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>.<a class="d intelliWindow-symbol" href="#over%3F" data-definition-place="defined-in-file">over?</a>
<a class="l" name="169" href="#169">169</a>      <b>if</b> <a href="/source/s?defs=STDIN" class="intelliWindow-symbol" data-definition-place="undefined-in-file">STDIN</a>.<b>getc</b> == <span class="s">?q</span> <b>then</b> <b>break</b> <b>end</b>
<a class="hl" name="170" href="#170">170</a>      <a href="/source/s?defs=bd" class="intelliWindow-symbol" data-definition-place="undefined-in-file">bd</a>.<a class="d intelliWindow-symbol" href="#reset" data-definition-place="defined-in-file">reset</a>
<a class="l" name="171" href="#171">171</a>    <b>end</b>
<a class="l" name="172" href="#172">172</a>  <b>end</b>
<a class="l" name="173" href="#173">173</a><b>ensure</b>
<a class="l" name="174" href="#174">174</a>  <b>system</b>(<span class="s">&quot;stty -raw echo&quot;</span>)
<a class="l" name="175" href="#175">175</a><b>end</b>
<a class="l" name="176" href="#176">176</a><b>print</b> <span class="s">&quot;\n&quot;</span>
<a class="l" name="177" href="#177">177</a><b>print</b> <span class="s">&apos;<a href="http://example.com">http://example.com</a>&apos;</span>
<a class="l" name="178" href="#178">178</a><b>puts</b> <span class="s">&quot;Last #{</span><a href="/source/s?defs=log_lines" class="intelliWindow-symbol" data-definition-place="undefined-in-file">log_lines</a><span class="s">} lines from #{</span><a href="/source/s?defs=logfn" class="intelliWindow-symbol" data-definition-place="undefined-in-file">logfn</a><span class="s">}:&quot;</span>
<a class="l" name="179" href="#179">179</a><b>print</b> <span class="s">&quot;\n&quot;</span>
<a class="hl" name="180" href="#180">180</a>;
<a class="l" name="181" href="#181">181</a>;
<a class="l" name="182" href="#182">182</a></body>
</html>
